﻿<%@ Page Title="" Language="C#" MasterPageFile="~/cms/cms.master" AutoEventWireup="true" CodeFile="ManageBill.aspx.cs" Inherits="cms_ManageBill" %>
<%--<script language="C#" runat="server">
    void updateHD(Object src, GridViewCommandEventArgs e)
    {
        int index = Convert.ToInt32(e.CommandArgument);

        // get the GridViewRow where the command is raised
        GridViewRow selectedRow = ((GridView)e.CommandSource).Rows[index];

        // for bound fields, values are stored in the Text property of Cells [ fieldIndex ]
        if (e.CommandName == "CapNhat")
        {
            MarketOnlineDTO.HoaDonDTO dto = new MarketOnlineDTO.HoaDonDTO();
            dto.TenKH = selectedRow.Cells[1].Text;
            dto.DienThoai = selectedRow.Cells[2].Text;
            dto.Email = selectedRow.Cells[3].Text;
            //dto.NgayGioDatHang = DateTime.Parse(selectedRow.Cells[4].Text);
            dto.DiaChiNhan = selectedRow.Cells[5].Text;
            //dto.NgayGioGiaoHang = DateTime.Parse(selectedRow.Cells[6].Text);
            //TongTien = double.Parse(selectedRow.Cells[7].Text);
            //dto.MaTinhTrangHD = int.Parse(selectedRow.Cells[8].Text);
            dto.MaTaiKhoan = selectedRow.Cells[9].Text;
            dto.HinhThucThanhToan = selectedRow.Cells[10].Text;

            MarketOnlineBUS.HoaDonBUS bus = new MarketOnlineBUS.HoaDonBUS();
            bus.CapNhatHoaDon(dto);
        }



    }

    void setButtonStyle(Object src, GridViewCommandEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            
            System.Data.IDataRecord rowView = (System.Data.IDataRecord)e.Row.DataItem;
            
            TableCellCollection cells = e.Row.Cells;
        }
    }
</script>--%>

<asp:Content ID="Content2" ContentPlaceHolderID="PageTittle" Runat="Server">
QUẢN LÝ HÓA ĐƠN BÁN HÀNG
<hr />
<br /><br />
</asp:Content>

<asp:Content ID="Content1" ContentPlaceHolderID="Content" Runat="Server">
    <div>
        <center>
            <asp:GridView ID="GridView1" runat="server" 
            AutoGenerateColumns="false" DataKeyNames="MaHoaDon" 
                onrowupdating="GridView1_RowUpdating" ShowFooter="True"
                onrowediting="GridView1_RowEditing" 
                onrowcancelingedit="GridView1_RowCancelingEdit" 
                onrowcommand="GridView1_RowCommand">
        <Columns>
            <asp:TemplateField HeaderText="Mã Hoá Ðơn">
                <EditItemTemplate>
                    <asp:Label ID ="lblMaHD" runat="server" Text='<%# Bind("MaHoaDon") %>'></asp:Label>
                </EditItemTemplate>
                <ItemTemplate>
                    <asp:Label ID="lblMaHD" runat="server" Text='<%# Bind("MaHoaDon") %>'></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Tên khách hàng">
                <EditItemTemplate>
                    <asp:Label Width="100px" ID="txtTenKH" runat="server" Text='<%# Bind("TenKH") %>'></asp:Label>
               </EditItemTemplate>
               <FooterTemplate> 
                    <asp:TextBox Width="100px" ID="txtNewTenKH" runat="server" ></asp:TextBox> 
                </FooterTemplate>
                <ItemTemplate>
                    <asp:Label  ID="lblTenKH" runat="server" Text='<%# Bind("TenKH") %>'></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Ðiện Thoại">
                <EditItemTemplate>
                    <asp:Label Width="100px" ID="txtDT" runat="server" Text='<%# Bind("DienThoai") %>'></asp:Label>
                </EditItemTemplate>
                <FooterTemplate> 
                    <asp:TextBox Width="100px" ID="txtNewDT" runat="server" ></asp:TextBox> 
                </FooterTemplate>
                <ItemTemplate>
                    <asp:Label ID="lblDT" runat="server" Text='<%# Bind("DienThoai") %>'></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Email">
                <EditItemTemplate>
                    <asp:Label Width="130px" ID="txtEmail" runat="server" Text='<%# Bind("Email") %>'></asp:Label>
                </EditItemTemplate>
                <FooterTemplate> 
                    <asp:TextBox Width="130px" ID="txtNewEmail" runat="server" ></asp:TextBox> 
                </FooterTemplate>
                <ItemTemplate>
                    <asp:Label ID="lblEmail" runat="server" Text='<%# Bind("Email") %>'></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Ngày giờ đặt hàng">
                 <EditItemTemplate>
                    <asp:Label Width="100px" ID="txtNgayGioDatHang" runat="server" Text='<%# Bind("NgayGioDatHang") %>' ></asp:Label>
                </EditItemTemplate>
                <FooterTemplate> 
                    <asp:TextBox Width="100px" ID="txtNewNgayGioDatHang" runat="server" ></asp:TextBox> 
                </FooterTemplate>
                <ItemTemplate>
                    <asp:Label ID="lblNgayGioDatHang" runat="server" Text='<%# Bind("NgayGioDatHang") %>' ></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Ðịa chỉ nhận">
                <EditItemTemplate>
                    <asp:Label Width="100px" ID="txtDiaChiNhan" runat="server" Text='<%# Bind("DiaChiNhan") %>'></asp:Label>
                </EditItemTemplate>
                <FooterTemplate> 
                    <asp:TextBox Width="100px" ID="txtNewDiaChiNhan" runat="server" ></asp:TextBox> 
                </FooterTemplate>
                <ItemTemplate>
                    <asp:Label ID="lblDiaChiNhan" runat="server" Text='<%# Bind("DiaChiNhan") %>'></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Ngày Giờ Giao Hàng">
                <EditItemTemplate>
                    <asp:Label Width="100px" ID="txtNgayGioGiaoHang" runat="server" Text='<%# Bind("NgayGioGiaoHang") %>'></asp:Label>
                </EditItemTemplate>
                <FooterTemplate> 
                    <asp:TextBox Width="100px" ID="txtNewNgayGioGiaoHang" runat="server" ></asp:TextBox> 
                </FooterTemplate>
                <ItemTemplate>
                    <asp:Label ID="lblNgayGioGiaoHang" runat="server" Text='<%# Bind("NgayGioGiaoHang") %>'></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Tổng tiền">
                <EditItemTemplate>
                    <asp:Label Width="50px" ID="txtTongTien" runat="server" Text='<%# Bind("TongTien") %>'></asp:Label>
                </EditItemTemplate>
                <FooterTemplate> 
                    <asp:TextBox Width="50px" ID="txtNewTongTien" runat="server" ></asp:TextBox> 
                </FooterTemplate>
                <ItemTemplate>
                    <asp:Label ID="lblTongTien" runat="server" Text='<%# Bind("TongTien") %>'></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Mã Tình trạng hoá đơn">
                <EditItemTemplate>
                    <asp:TextBox Width="40px" ID="txtTinhTrangHD" runat="server" Text='<%# Bind("MaTinhTrangHD") %>'></asp:TextBox>
                </EditItemTemplate>
                <FooterTemplate> 
                    <asp:TextBox Width="40px" ID="txtNewTinhTrangHD" runat="server" ></asp:TextBox> 
                </FooterTemplate>
                <ItemTemplate>
                    <asp:Label ID="lblTinhTrangHD" runat="server" Text='<%# Bind("MaTinhTrangHD") %>'></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Mã tài khoản">
                <EditItemTemplate>
                    <asp:Label Width="75px" ID="txtMaTK" runat="server" Text='<%# Bind("MaTaiKhoan") %>'></asp:Label>
                </EditItemTemplate>
                <FooterTemplate> 
                    <asp:TextBox Width="75px" ID="txtNewMaTK" runat="server" ></asp:TextBox> 
                </FooterTemplate>
                <ItemTemplate>
                    <asp:Label ID="lblMaTK" runat="server" Text='<%# Bind("MaTaiKhoan") %>'></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Hình thức thanh toán">
                <EditItemTemplate>
                    <asp:Label Width="50px" ID="txtHinhThucTT" runat="server" Text='<%# Bind("HinhThucThanhToan") %>'></asp:Label>
                </EditItemTemplate>
                <FooterTemplate> 
                    <asp:TextBox Width="50px" ID="txtNewHinhThucThanhToan" runat="server" ></asp:TextBox> 
                </FooterTemplate>
                <ItemTemplate>
                    <asp:Label ID="lblHinhThucTT" runat="server" Text='<%# Bind("HinhThucThanhToan") %>'></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>

            <asp:TemplateField HeaderText="Edit" ShowHeader="False" HeaderStyle-HorizontalAlign="Left"> 
                <EditItemTemplate> 
                    <asp:LinkButton ID="lbkUpdate" runat="server" CausesValidation="True" CommandName="Update" Text="Update"></asp:LinkButton> 
                    <asp:LinkButton ID="lnkCancel" runat="server" CausesValidation="False" CommandName="Cancel" Text="Cancel"></asp:LinkButton> 
                </EditItemTemplate> 
                <FooterTemplate> 
                    <asp:LinkButton ID="lnkAdd" runat="server" CausesValidation="False" CommandName="Insert" Text="Insert"></asp:LinkButton> 
                </FooterTemplate> 
                <ItemTemplate> 
                    <asp:LinkButton ID="lnkEdit" runat="server" CausesValidation="False" CommandName="Edit" Text="Edit"></asp:LinkButton> 
                </ItemTemplate> 
            </asp:TemplateField> 

            <%--<asp:CommandField HeaderText="Delete" ShowDeleteButton="True" ShowHeader="True" /> --%>

            
          <%--<asp:ButtonField ButtonType="button" CommandName="CapNhat" Text="Cập nhật" />--%>
            <%--<asp:CommandField ButtonType="Button" ShowSelectButton="True" />--%>
        </Columns>
        
        </asp:GridView>
        
        </center>

    </div>
</asp:Content>

